package com.klarna.raas.ws.domain;

import java.math.BigInteger;

import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * The Class Fund.
 */
public class PersonInfo{
	private static final String NOT_AVAILABLE = "NA";
	
	private BigInteger id;
	private String firstName;
	private String lastName;
	private String street;
	private String city;
	private String zip;
	private String careOf;
	private String country;
	private String birthDate;
	
	public PersonInfo() {
		this.id = BigInteger.ZERO;
		this.firstName = PersonInfo.NOT_AVAILABLE;
		this.lastName = PersonInfo.NOT_AVAILABLE;
		this.street = PersonInfo.NOT_AVAILABLE;
		this.city = PersonInfo.NOT_AVAILABLE;
		this.zip = PersonInfo.NOT_AVAILABLE;
		this.careOf = PersonInfo.NOT_AVAILABLE;
		this.country = PersonInfo.NOT_AVAILABLE;
		this.birthDate = PersonInfo.NOT_AVAILABLE;
	}
	
	public PersonInfo(String body) {
		if (body!=null && !body.isEmpty()) {
			String[] params = body.split(",");
			this.id = new BigInteger(params[0]);
			this.firstName = params[2];
			this.lastName = params[3];
			this.street = params[4];
			this.city = params[5];
			this.zip = params[6];
			this.careOf = params[7];
			this.country = params[8];
			this.birthDate = params[10];
		} else {
			throw new IllegalArgumentException("body=" + body);
		}
	}
	public BigInteger getId() {
		return id;
	}
	public void setId(BigInteger id) {
		this.id = id;
	}
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	public String getStreet() {
		return street;
	}
	public void setStreet(String street) {
		this.street = street;
	}
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	public String getZip() {
		return zip;
	}
	public void setZip(String zip) {
		this.zip = zip;
	}
	public String getCareOf() {
		return careOf;
	}
	public void setCareOf(String careOf) {
		this.careOf = careOf;
	}
	public String getCountry() {
		return country;
	}
	public void setCountry(String country) {
		this.country = country;
	}
	public String getBirthDate() {
		return birthDate;
	}
	public void setBirthDate(String birtDate) {
		this.birthDate = birtDate;
	}

	@Override	
	 public String toString() {
		 return new ToStringBuilder(this).
			       append("id", id.toString()).
			       append("firstName", firstName).
			       append("lastName", lastName).
			       append("street", street).
			       append("city", city).
			       append("zip", zip).
			       append("careOf", careOf).
			       append("country", country).
			       append("birthDate", birthDate).
	       toString();
	   }

}
